1 Load data

Data is loaded from source on Github.

Some modifications to the data-characteristics and preparing the graphs.

### MODIFY Deaths

deaths$sum <- as.double(NA)

deaths <- deaths %>% mutate(sum = rowSums(.[5:38]))

deaths2 <- deaths %>%
rename('Province' = `Province/State`, 'Country' = 'Country/Region')


#### MODIFY Cases
cases2 <- cases %>%
rename('Province' = `Province/State`, 'Country' = 'Country/Region')

cases3 <- cases2 %>%
select(Country, Confirmed, Deaths, Recovered) %>%
group_by(Country)

cases3 <- summarise(cases3,
count = n(),
Confirmed = sum(Confirmed),
Deaths = sum(Deaths),
Recovered = sum(Recovered)
)


cases3$rate <- ((cases3$Deaths/cases3$Confirmed) * 100)
cases3$rate <- round(cases3$rate, digits = 1)

cases3 <- arrange(cases3, Country)

###### Make some nice plots

l1 <- leaflet(data = deaths2) %>% addTiles() %>%
addMarkers(~Long, ~Lat, popup = ~as.character(sum), label = ~as.character(Country))




# COVID-19 Deaths

getColor <- function(deaths2) {
sapply(deaths2$sum, function(sum) {
if(sum < 1) {
"green"
} else if(sum <= 10) {
"orange"
} else {
"red"
} })
}


icons <- awesomeIcons(
icon = 'ios-close',
iconColor = 'black',
library = 'ion',
markerColor = getColor(deaths2)
)

l2 <- leaflet(deaths2) %>% addTiles() %>%
addAwesomeMarkers(~Long, ~Lat, icon=icons, label=~as.character(sum))






k1 <- kable(cases3, caption = "Novid Coronavirus-19 overview by Country.") %>%
kable_styling(bootstrap_option = c("striped", "hover", "condensed"))


# k2 <- cases3 %>%
#   mutate(rate = cell_spec, function(x) {
#     cell_spec(cases3$rate, bold = T, 
#               color = spec_color(x, end = 0.9),
#               font_size = spec_font_size(x))}) %>%
#   kable(escape = F, align = "c") %>%
#   kable_styling(c("striped", "condensed"), full_width = F)
# 

# 
# k2 <- cases3 %>%
#   mutate(
#     Country = row.names(.),
#     rate = cell_spec(rate, "html", function(x) {
#     cell_spec(cases3$rate, bold = T, 
#               color = spec_color(x, end = 0.9),
#               font_size = spec_font_size(x))})
#   )

#k1


#### Confirmed cases in the world

consum <- Confirmed %>% 
  select(-`Province/State`, -Lat, -Long) %>% 
  rename(Country = `Country/Region`)



consum <-consum %>% 
  pivot_longer(-Country, names_to  = "Date", values_to = "confirmed") 



consum$Date <- as.Date(consum$Date, "%m/%d/%y")


consum <- consum %>% 
  group_by(Country, Date)

consum <- summarise(consum, 
                            count = n(),
                            confirmed = sum(confirmed, na.rm = TRUE))

consum <- ungroup(consum)




p <- plot_ly(consum, x = ~Date, y = ~confirmed, type = 'scatter',  color = ~Country , mode = 'lines', text = ~paste('country', Country))

Number of Confirmed cases. (Click ‘Mainland China’ to have a better view of the rest of the world.)

Number of deaths per Country.

Table.

Novid Coronavirus-19 overview by Country.
Country count Confirmed Deaths Recovered rate
Afghanistan 1 1 0 0 0.0
Algeria 1 1 0 0 0.0
Australia 6 25 0 11 0.0
Austria 1 9 0 0 0.0
Bahrain 1 41 0 0 0.0
Belarus 1 1 0 0 0.0
Belgium 1 1 0 1 0.0
Brazil 1 2 0 0 0.0
Cambodia 1 1 0 1 0.0
Canada 4 20 0 6 0.0
Croatia 1 6 0 0 0.0
Denmark 1 3 0 0 0.0
Egypt 1 1 0 1 0.0
Estonia 1 1 0 0 0.0
Finland 1 3 0 1 0.0
France 1 100 2 12 2.0
Georgia 1 1 0 0 0.0
Germany 1 79 0 16 0.0
Greece 1 4 0 0 0.0
Hong Kong 1 95 2 33 2.1
Iceland 1 1 0 0 0.0
India 1 3 0 3 0.0
Iran 1 593 43 123 7.3
Iraq 1 13 0 0 0.0
Ireland 1 1 0 0 0.0
Israel 1 7 0 1 0.0
Italy 1 1128 29 46 2.6
Japan 1 241 5 32 2.1
Kuwait 1 45 0 0 0.0
Lebanon 1 4 0 0 0.0
Lithuania 1 1 0 0 0.0
Luxembourg 1 1 0 0 0.0
Macau 1 10 0 8 0.0
Mainland China 31 79251 2835 39279 3.6
Malaysia 1 25 0 18 0.0
Mexico 1 4 0 0 0.0
Monaco 1 1 0 0 0.0
Nepal 1 1 0 1 0.0
Netherlands 1 6 0 0 0.0
New Zealand 1 1 0 0 0.0
Nigeria 1 1 0 0 0.0
North Macedonia 1 1 0 0 0.0
Norway 1 15 0 0 0.0
Oman 1 6 0 1 0.0
Others 1 705 6 10 0.9
Pakistan 1 4 0 0 0.0
Philippines 1 3 1 1 33.3
Qatar 1 1 0 0 0.0
Romania 1 3 0 0 0.0
Russia 1 2 0 2 0.0
San Marino 1 1 0 0 0.0
Singapore 1 102 0 72 0.0
South Korea 1 3150 16 27 0.5
Spain 1 45 0 2 0.0
Sri Lanka 1 1 0 1 0.0
Sweden 1 12 0 0 0.0
Switzerland 1 18 0 0 0.0
Taiwan 1 39 1 9 2.6
Thailand 1 42 0 28 0.0
UK 1 23 0 8 0.0
United Arab Emirates 1 21 0 5 0.0
US 19 70 1 7 1.4
Vietnam 1 16 0 16 0.0